/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package facade;

import entity.CorsoStudio;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author grillo
 */
@Stateless
public class CorsoStudioFacade implements CorsoStudioFacadeLocal, CorsoStudioFacadeRemote {
    @PersistenceContext
    private EntityManager em;

    public void create(CorsoStudio corsoStudio) {
        em.persist(corsoStudio);
    }

    public void edit(CorsoStudio corsoStudio) {
        em.merge(corsoStudio);
    }

    public void remove(CorsoStudio corsoStudio) {
        em.remove(em.merge(corsoStudio));
    }

    public CorsoStudio find(Object id) {
        return em.find(CorsoStudio.class, id);
    }

    public List<CorsoStudio> findAll() {
        return em.createQuery("select object(o) from CorsoStudio as o").getResultList();
    }

}
